package com.flca.frw.zk.validate;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.WrongValueException;

import com.flca.frw.util.TransformUtils;
import com.flca.frw.validators.ValidationError;
import com.flca.frw.validators.Validator;

public class ValidateDateFuture extends ValidateDateConstraintBase{

	public ValidateDateFuture() {
		super();
	}

	public void validate(Component aComp, Object aValue) throws WrongValueException  {
		List<ValidationError> errors = new ArrayList<ValidationError>();
		Date now = new Date();
		if (!Validator.testGreaterOrEquals(getTestDate(),now , errors, "", null)) {
			TransformUtils tu = TransformUtils.getInstance();
			String msg = "Datum te nieuw, mamimum = " + tu.date2String(now); 
			throw new WrongValueException(aComp, msg);
		}
	}
}
